package logic.regulardevices;

public class WaterLeakageAlarm extends RegularDevice {

	private boolean alarm;
	
	public WaterLeakageAlarm() {
		id = "wl";
	}
	@Override
	public String receiveAndRespond(String cmd) {
		if(cmd.equals("on")) {
			return alarmOn();
		} else if(cmd.equals("off")) {
			return alarmOff();
		} else if(cmd.equals("check")) { //checks the firealarms state.
			return check();
		}
		return invalidCommand();
	}

	private String alarmOn() {
		alarm=true;
		return "on";
	}
	private String alarmOff() {
		alarm=false;
		return "off";
	}
	@Override
	public String check() {
		if(alarm)
			return "on";
		return"off";
	}

	@Override
	public String test() {
		// TODO Auto-generated method stub
		return null;
	}

}
